<?php

namespace App\Api;

use PhalApi\Api;
use App\Domain\IdcardCheck as DM;


/**
 * 禁毒上传身份
 * @desc 禁毒上传身份
 * @author: dogstar <chanzonghuang@gmail.com> 2014-10-04
 */
class FcjdCheck extends Api
{
    public function getRules()
    {
        return array(
            'checkIdCard' => array(
                'filePath'     => array('name' => 'filePath', 'desc' => 'ocr图片地址'),
                'pic_IdCard'   => array('name' => 'pic_IdCard', 'desc' => 'pic_IdCard'),
                'pic_Portrait' => array('name' => 'pic_Portrait', 'desc' => 'pic_Portrait'),
                'pic'          => array('name' => 'pic', 'desc' => '人像图片地址'),
                'result'       => array('name' => 'result', 'desc' => 'ocr返回json'),
                'Address'      => array('name' => 'Address', 'desc' => '地址'),
                'Birth'        => array('name' => 'Birth', 'desc' => '生日'),
                'IdNum'        => array('name' => 'IdNum', 'require' => true, 'desc' => '身份证号'),
                'Name'         => array('name' => 'Name', 'require' => true, 'desc' => '姓名'),
                'phone'        => array('name' => 'phone', 'desc' => '手机号'),
                'Nation'       => array('name' => 'Nation', 'desc' => '民族'),
                'Sex'          => array('name' => 'Sex', 'desc' => '性别'),
                'from_unit'    => array('name' => 'from_unit', 'desc' => '送检单位'),
                'from_unit_code'    => array('name' => 'from_unit_code', 'desc' => '送检单位'),
                'checker'      => array('name' => 'checker', 'desc' => '采集员'),
                'openid'       => array('name' => 'openid', 'desc' => '微信openid'),
                'pay'          => array('name' => 'pay', 'desc' => '是否已经支付'),
                'channel'      => array('name' => 'channel', 'desc' => '渠道'),
                'avatarUrl'    => array('name' => 'avatarUrl', 'desc' => '微信头像'),
                'wechat'       => array('name' => 'wechat', 'desc' => '微信号'),
                'nickName'     => array('name' => 'nickName', 'desc' => '昵称'),
                'category'     => array('name' => 'category', 'desc' => '检测类别'),
                'type'         => array('name' => 'type', 'desc' => '检测方法'),
                'content'      => array('name' => 'content', 'desc' => '检测内容'),
                'hair'         => array('name' => 'hair', 'desc' => '毛发种类'),
                'hair_long'    => array('name' => 'hair_long', 'desc' => '毛发长度'),
                'testing'      => array('name' => 'Name', 'desc' => '检测员'),
                'rpic'         => array('name' => 'rpic', 'desc' => '结果图片'),
                'res'          => array('name' => 'res', 'desc' => '结果合集'),
                'MOP'          => array('name' => 'MOP', 'desc' => '吗啡'),
                'MET'          => array('name' => 'MET', 'desc' => '甲苦苯丙胺'),
                'KET'          => array('name' => 'KET', 'desc' => '氯胺酮'),
                'other'        => array('name' => 'other', 'desc' => 'other'),
                'uid'          => array('name' => 'uid', 'desc' => '单条编码'),
                'unit'         => array('name' => 'unit', 'desc' => '单位'),
            ),
            'qrcode'      => array()
        );
    }

    /**
     * 禁毒上传身份
     * @desc 禁毒上传身份
     * @return array data 数据内容
     * @return int count 当前条件下总数
     * @exception 400 非法请求，参数传递错误
     */
    public function checkIdCard()
    {
        // 最简单的处理方式
        header('Access-Control-Allow-Origin:*');
        header('Access-Control-Allow-Headers:*');

        $DM = new DM();
        return $DM->checkIdCard($this);
    }

    /**
     * 禁毒码
     * @desc 禁毒上传身份
     * @return array data 数据内容
     * @return int count 当前条件下总数
     * @exception 400 非法请求，参数传递错误
     */
    public function checkInfo()
    {
        // 最简单的处理方式
        header('Access-Control-Allow-Origin:*');
        header('Access-Control-Allow-Headers:*');

        $DM = new DM();
        return $DM->checkInfo($this);
    }


    /**
     * 禁毒七牛码
     * @desc 禁毒上传身份
     * @return array data 数据内容
     * @return int count 当前条件下总数
     * @exception 400 非法请求，参数传递错误
     */
    public function qrcode()
    {
        // 最简单的处理方式
        header('Access-Control-Allow-Origin:*');
        header('Access-Control-Allow-Headers:*');
        $json = file_get_contents('php://input');
        $obj = json_decode($json, true);
        $DM = new DM();
        return $DM->checkInfoQiNiu($obj);
    }


}
